package com.multi.thread.chapter01;

public class StopByReturnThread extends Thread {
	
	@Override
	public void run() {
		while (true) {
			if (this.isInterrupted()) {
				System.out.println("停止了!");
				return;
			}
			System.out.println("timer = " + System.currentTimeMillis());
		}
	}
	
	public static void main(String[] args) throws InterruptedException {
		StopByReturnThread thread = new StopByReturnThread();
		thread.start();
		Thread.sleep(2);
		thread.interrupt();
	}

}
